Skip to content

fix(otlp): preserve service-entry trace metrics - #9774

Draft
mabdinur wants to merge 25 commits into
masterfrom
codex/otlp-trace-metrics-service-boundaries
Draft

fix(otlp): preserve service-entry trace metrics#9774
mabdinur wants to merge 25 commits into
masterfrom
codex/otlp-trace-metrics-service-boundaries

Conversation

@mabdinur

@mabdinur mabdinur commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Tracks local parent services only when the OTLP trace-metrics exporter is enabled
  • Marks cross-service children and spans with remote parents as top-level
  • Preserves parent service state across partial flushes

Motivation

This is stacked on #9685 so service-boundary inference remains separate from the core attribute translation and resolves the remote-parent gap reported in review

Additional Notes

The native-stats benchmark with OTLP disabled stays at baseline: 1.23s median here versus 1.26s on master. Focused tests, npm run lint, and the merged-main OTLP system-test suite pass; the suite reports 38 passed, 3 expected failures, and 10 expected-failure tests passing

mabdinur added 20 commits August 4, 2026 15:25
Fixes several OTLP trace-metrics (traces.span.sdk.metrics.duration)
attribute gaps found in a cross-tracer audit against SEMCON-1093:

- datadog.process_tags now emits one array-valued resource attribute
  (mirroring the legacy v0.6/stats ProcessTags shape) instead of
  flattening each tag into its own datadog.<key> attribute.
- datadog.is_trace_root is now emitted per data point, gated the same
  way as the other datadog.* attributes.
- span.kind is canonicalized to the OTel Span Metrics Connector's
  SPAN_KIND_* uppercase convention instead of being passed through
  lowercase.
- status.code is now a required string attribute
  (STATUS_CODE_OK/STATUS_CODE_ERROR) on every data point, replacing
  the previous OTLP-trace-style int enum that was only set on errors.

additional_metric_tags and peer_tags remain unimplemented on this
path; both are flagged with a one-line TODO pointing at the
corresponding gap (or its absence) in the legacy v0.6/stats exporter.
service.name was omitted from OTLP trace-metrics data points whenever
a span's service matched the default/global service, mirroring the
status.code fix earlier in this branch: required attributes must be
unconditional, not skipped as an optimization.
Native stats without OTLP regressed from a 1.26s to 1.43s benchmark median because service-boundary state was tracked for every span. Removing that tracking restores the master baseline; the behavior will move to an OTLP-gated follow-up.
Gate service tracking on the OTLP exporter so native stats keep the baseline hot path. Preserve parent services across partial flushes and treat spans whose parent is absent locally as service entries.
@dd-octo-sts

dd-octo-sts Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 7.99 MB
Deduped: 8.65 MB
No deduping: 8.65 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.3 | 125.43 kB | 441.68 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@datadog-official

datadog-official Bot commented Aug 11, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog auto-retried 1 job - 1 passed on retry View in Datadog

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 98.56% (+0.03%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0698550 | Docs | Datadog PR Page | Give us feedback!

@pr-commenter

pr-commenter Bot commented Aug 11, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-11 20:17:40

Comparing candidate commit 0698550 in PR branch codex/otlp-trace-metrics-service-boundaries with baseline commit 2cbc50e in branch munir/otlp-trace-metrics-fixes.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2330 metrics, 28 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:appsec-appsec-enabled-24

  • unstable execution_time [-215.693ms; +204.732ms] or [-7.941%; +7.538%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-228.403ms; +225.507ms] or [-8.807%; +8.695%]

scenario:appsec-appsec-enabled-with-attacks-24

  • unstable execution_time [-160.065ms; +155.297ms] or [-5.105%; +4.953%]

scenario:appsec-appsec-enabled-with-attacks-26

  • unstable execution_time [-179.176ms; +194.406ms] or [-6.105%; +6.624%]

scenario:appsec-control-20

  • unstable execution_time [-113.420ms; +134.507ms] or [-6.750%; +8.005%]

scenario:appsec-control-24

  • unstable execution_time [-111775.208µs; +112864.874µs] or [-8.918%; +9.005%]

scenario:appsec-control-26

  • unstable execution_time [-123.629ms; +127.354ms] or [-9.856%; +10.153%]

scenario:appsec-iast-no-vulnerability-iast-enabled-default-config-20

  • unstable execution_time [-12385.609µs; +13885.313µs] or [-4.862%; +5.451%]

scenario:appsec-iast-with-vulnerability-iast-enabled-default-config-20

  • unstable execution_time [-28.877ms; +32.888ms] or [-5.250%; +5.979%]

scenario:debugger-line-probe-with-snapshot-default-24

  • unstable cpu_user_time [-285.378ms; +631.047ms] or [-3.693%; +8.167%]
  • unstable execution_time [-248.373ms; +632.947ms] or [-2.946%; +7.507%]
  • unstable instructions [-2.6G instructions; +5.5G instructions] or [-4.209%; +8.702%]
  • unstable throughput [-278.872op/s; +109.222op/s] or [-7.302%; +2.860%]

scenario:debugger-line-probe-with-snapshot-minimal-26

  • unstable cpu_user_time [-2681.929ms; +4229.491ms] or [-28.098%; +44.312%]
  • unstable execution_time [-2841.709ms; +4423.660ms] or [-27.655%; +43.051%]
  • unstable instructions [-24.9G instructions; +37.2G instructions] or [-30.897%; +46.282%]
  • unstable max_rss_usage [-8.595MB; +13.346MB] or [-5.408%; +8.397%]
  • unstable throughput [-844.597op/s; +552.726op/s] or [-26.090%; +17.074%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-278.206ms; +353.802ms] or [-5.943%; +7.558%]
  • unstable execution_time [-275.268ms; +356.467ms] or [-5.788%; +7.496%]
  • unstable throughput [-127151.572op/s; +96666.758op/s] or [-7.212%; +5.483%]

scenario:plugin-claude-agent-sdk-compact-stream-scan-26

  • unstable cpu_usage_percentage [-5.664%; +5.407%]

scenario:plugin-graphql-long-with-depth-and-collapse-off-20

  • unstable max_rss_usage [-17.607MB; +39.477MB] or [-4.486%; +10.057%]

scenario:plugin-graphql-long-with-depth-off-26

  • unstable max_rss_usage [-29028.311KB; +29636.882KB] or [-16.070%; +16.407%]

scenario:plugin-pg-service-20

  • unstable cpu_usage_percentage [-8.939%; +5.516%]
  • unstable execution_time [-128.001ms; +202.416ms] or [-7.663%; +12.119%]
  • unstable throughput [-312897.897op/s; +199468.635op/s] or [-8.616%; +5.493%]

scenario:test-optimization-large-suite-20

  • unstable max_rss_usage [-3.581MB; +8.080MB] or [-4.455%; +10.050%]

…into codex/otlp-trace-metrics-service-boundaries

# Conflicts:
#	packages/dd-trace/src/span_processor.js
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.55%. Comparing base (77cd463) to head (0698550).
⚠️ Report is 45 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master    #9774     +/-   ##
=========================================
  Coverage   98.55%   98.55%             
=========================================
  Files         966      966             
  Lines      139420   139534    +114     
  Branches    12543    13998   +1455     
=========================================
+ Hits       137407   137522    +115     
+ Misses       2013     2012      -1     
Flag Coverage Δ
aiguard 57.01% <100.00%> (+<0.01%) ⬆️
aiguard-integration 55.86% <22.22%> (-0.02%) ⬇️
apm-bucket-0 57.25% <100.00%> (+<0.01%) ⬆️
apm-bucket-1 63.38% <100.00%> (+<0.01%) ⬆️
apm-bucket-2 62.23% <100.00%> (+<0.01%) ⬆️
apm-bucket-3 59.82% <100.00%> (+<0.01%) ⬆️
apm-capabilities-tracing 62.37% <100.00%> (+0.04%) ⬆️
apm-integrations-aerospike 56.30% <100.00%> (+<0.01%) ⬆️
apm-integrations-confluentinc-kafka-javascript 61.21% <100.00%> (+<0.01%) ⬆️
apm-integrations-couchbase 56.74% <100.00%> (+<0.01%) ⬆️
apm-integrations-http 61.92% <100.00%> (+<0.01%) ⬆️
apm-integrations-kafkajs 61.73% <100.00%> (+<0.01%) ⬆️
apm-integrations-next 59.42% <100.00%> (+<0.01%) ⬆️
apm-integrations-prisma 58.53% <100.00%> (+<0.01%) ⬆️
appsec 72.13% <100.00%> (+0.02%) ⬆️
appsec-express_fastify_graphql 69.44% <100.00%> (-0.01%) ⬇️
appsec-integration 50.16% <22.22%> (-0.01%) ⬇️
appsec-kafka_ldapjs_lodash 63.42% <100.00%> (+<0.01%) ⬆️
appsec-mongodb-core_mongoose_mysql 66.88% <100.00%> (-0.01%) ⬇️
appsec-next 56.68% <100.00%> (+<0.01%) ⬆️
appsec-node-serialize_passport_postgres 66.29% <100.00%> (-0.01%) ⬇️
appsec-sourcing_stripe_template 64.73% <100.00%> (+<0.01%) ⬆️
debugger 64.26% <100.00%> (+<0.01%) ⬆️
instrumentations-bucket-0 51.68% <11.11%> (-0.06%) ⬇️
instrumentations-bucket-1 59.42% <100.00%> (+<0.01%) ⬆️
instrumentations-bucket-10 60.90% <100.00%> (+<0.01%) ⬆️
instrumentations-bucket-11 61.62% <100.00%> (+<0.01%) ⬆️
instrumentations-bucket-12 51.69% <11.11%> (-0.06%) ⬇️
instrumentations-bucket-13 52.42% <11.11%> (-0.05%) ⬇️
instrumentations-bucket-14 51.64% <11.11%> (-0.06%) ⬇️
instrumentations-bucket-2 53.12% <11.11%> (-0.05%) ⬇️
instrumentations-bucket-3 53.48% <11.11%> (-0.05%) ⬇️
instrumentations-bucket-4 58.79% <100.00%> (+<0.01%) ⬆️
instrumentations-bucket-5 50.29% <11.11%> (-0.05%) ⬇️
instrumentations-bucket-6 60.52% <100.00%> (+<0.01%) ⬆️
instrumentations-bucket-7 58.13% <100.00%> (+<0.01%) ⬆️
instrumentations-bucket-8 59.10% <100.00%> (-0.01%) ⬇️
instrumentations-bucket-9 57.47% <100.00%> (+<0.01%) ⬆️
instrumentations-instrumentation-couchbase 50.94% <11.11%> (-0.06%) ⬇️
instrumentations-integration-esbuild 34.22% <7.40%> (-0.02%) ⬇️
llmobs-ai_anthropic_bedrock 62.86% <100.00%> (+<0.01%) ⬆️
llmobs-bucket-1 61.36% <100.00%> (+<0.01%) ⬆️
llmobs-openai 61.76% <100.00%> (+<0.01%) ⬆️
llmobs-openai-agents_vertex-ai 60.05% <100.00%> (+<0.01%) ⬆️
llmobs-sdk 66.80% <100.00%> (-0.01%) ⬇️
openfeature 55.66% <22.22%> (-0.03%) ⬇️
openfeature-unit 53.21% <11.11%> (-0.06%) ⬇️
platform-core_esbuild_instrumentations-misc 41.25% <11.11%> (-0.03%) ⬇️
platform-integration 60.41% <22.22%> (-0.03%) ⬇️
platform-shimmer_unit-guardrails_webpack 38.91% <11.11%> (-0.03%) ⬇️
plugins-bucket-0 56.95% <100.00%> (+<0.01%) ⬆️
plugins-bucket-1 54.00% <22.22%> (-0.03%) ⬇️
plugins-bucket-11 61.50% <100.00%> (+<0.01%) ⬆️
plugins-bucket-17 61.32% <100.00%> (+<0.01%) ⬆️
plugins-bucket-18 61.94% <100.00%> (+<0.01%) ⬆️
plugins-bucket-19 61.33% <100.00%> (+<0.01%) ⬆️
plugins-bucket-20 63.74% <100.00%> (+<0.01%) ⬆️
plugins-bucket-4 58.33% <100.00%> (+<0.01%) ⬆️
plugins-bullmq_cassandra_cookie 61.40% <100.00%> (+<0.01%) ⬆️
plugins-cookie-parser_crypto_dd-trace-api 56.38% <100.00%> (+<0.01%) ⬆️
plugins-fetch_fs_generic-pool 58.28% <100.00%> (+0.04%) ⬆️
plugins-google-cloud-pubsub_grpc_handlebars 64.16% <100.00%> (-0.01%) ⬇️
plugins-hapi_hono_ioredis 59.92% <100.00%> (+<0.01%) ⬆️
plugins-knex_langgraph_ldapjs 55.10% <100.00%> (+<0.01%) ⬆️
plugins-light-my-request_limitd-client_lodash 58.40% <100.00%> (+<0.01%) ⬆️
plugins-mariadb_memcached_mercurius 61.31% <100.00%> (+<0.01%) ⬆️
plugins-mongodb_mongodb-core_mongoose 59.28% <100.00%> (+<0.01%) ⬆️
plugins-multer_mysql_mysql2 58.87% <100.00%> (+<0.01%) ⬆️
plugins-nats_node-serialize_opensearch 60.42% <100.00%> (+<0.01%) ⬆️
plugins-passport-http_pino_postgres 58.61% <100.00%> (+<0.01%) ⬆️
plugins-process_pug_redis 57.42% <100.00%> (+<0.01%) ⬆️
plugins-undici_url_valkey 58.01% <100.00%> (-0.04%) ⬇️
plugins-vm_winston_ws 59.62% <100.00%> (+<0.01%) ⬆️
profiling 61.53% <100.00%> (+<0.01%) ⬆️
serverless-aws-sdk-aws-sdk 55.15% <100.00%> (+<0.01%) ⬆️
serverless-aws-sdk-base-inject-field 50.91% <11.11%> (-0.06%) ⬇️
serverless-aws-sdk-bedrockruntime 54.68% <100.00%> (+<0.01%) ⬆️
serverless-aws-sdk-client 56.25% <100.00%> (+<0.01%) ⬆️
serverless-aws-sdk-dynamodb 55.53% <100.00%> (+0.01%) ⬆️
serverless-aws-sdk-eventbridge 49.71% <11.11%> (-0.05%) ⬇️
serverless-aws-sdk-kinesis 59.10% <100.00%> (+<0.01%) ⬆️
serverless-aws-sdk-lambda 57.26% <100.00%> (+<0.01%) ⬆️
serverless-aws-sdk-s3 55.61% <100.00%> (+<0.01%) ⬆️
serverless-aws-sdk-serverless-peer-service 59.36% <100.00%> (+<0.01%) ⬆️
serverless-aws-sdk-sns 59.91% <100.00%> (+<0.01%) ⬆️
serverless-aws-sdk-sqs 60.32% <100.00%> (+<0.01%) ⬆️
serverless-aws-sdk-stepfunctions 55.45% <100.00%> (+<0.01%) ⬆️
serverless-aws-sdk-util 51.44% <11.11%> (-0.06%) ⬇️
serverless-bucket-0 54.05% <22.22%> (-0.03%) ⬇️
serverless-bucket-1 58.88% <100.00%> (+<0.01%) ⬆️
test-optimization-cucumber 71.04% <100.00%> (-0.03%) ⬇️
test-optimization-cypress 64.83% <22.22%> (+0.04%) ⬆️
test-optimization-jest 72.46% <100.00%> (+0.01%) ⬆️
test-optimization-mocha 72.12% <100.00%> (+0.05%) ⬆️
test-optimization-playwright-playwright-atr 59.86% <22.22%> (-0.05%) ⬇️
test-optimization-playwright-playwright-efd 60.00% <22.22%> (-0.03%) ⬇️
test-optimization-playwright-playwright-final-status 60.16% <22.22%> (-0.04%) ⬇️
test-optimization-playwright-playwright-impacted-tests 59.70% <22.22%> (+0.11%) ⬆️
test-optimization-playwright-playwright-reporting 60.86% <22.22%> (-0.14%) ⬇️
test-optimization-playwright-playwright-test-management 60.68% <22.22%> (-0.29%) ⬇️
test-optimization-playwright-playwright-test-span 59.87% <22.22%> (-0.07%) ⬇️
test-optimization-selenium 59.06% <22.22%> (-0.18%) ⬇️
test-optimization-testopt 57.60% <22.22%> (+0.05%) ⬆️
test-optimization-vitest 73.33% <100.00%> (+0.03%) ⬆️
test-optimization-vitest-browser 58.94% <22.22%> (+0.02%) ⬆️
test-optimization-webdriverio 65.44% <22.22%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mabdinur
mabdinur force-pushed the munir/otlp-trace-metrics-fixes branch 2 times, most recently from 5069eb6 to a849759 Compare August 14, 2026 13:52
Base automatically changed from munir/otlp-trace-metrics-fixes to master August 14, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant